/****************************************************
    文件：LoadingWnd.cs
	作者：kk
    邮箱: 627515104@qq.com
    日期：2020/8/26 15:4:32
	功能：Nothing
*****************************************************/

using UnityEngine;
using UnityEngine.UI;

public class LoadingWnd : WindowRoot
{
    public Text txtTips;
    public Image imgFG;
    public Image imgPoint;
    public Text txtPrg;

    private float fgWidth;

    protected override void InitWnd()
    {
        base.InitWnd();
        fgWidth = imgFG.GetComponent<RectTransform>().sizeDelta.x;

        SetText(txtTips,"测试");
        SetText(txtPrg,"0%");
        imgFG.fillAmount = 0;
        imgPoint.transform.localPosition=new Vector3(-545,0,0);
    }


    public void SetProgress(float prg)
    {
       SetText(txtPrg, (int)(prg * 100) + "%");
        imgFG.fillAmount = prg;

        float posX = prg * fgWidth - 545;
        imgPoint.GetComponent<RectTransform>().anchoredPosition=new Vector2(posX,0);
    }
}